package cn.epsilon3.constant;

import cn.epsilon3.exception.Epsilon3Exception;

/**
 * 资源类型enum
 */
public enum ResourceTypeEnum {

    CATALOG("C", "目录"),

    ROUTER("R", "路由"),

    FUNCTION("F","功能")
    ;


    private final String type;

    private final String desc;

    ResourceTypeEnum(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static ResourceTypeEnum valuesOf(String type) {
        for (ResourceTypeEnum resourceTypeEnum : ResourceTypeEnum.values()) {
            if (type.equalsIgnoreCase(resourceTypeEnum.getType())) {
                return resourceTypeEnum;
            }
        }
        throw new Epsilon3Exception("未找到[" + type + "]对应枚举");
    }

    @Override
    public String toString() {
        return "ResultEnum{" +
                "type=" + type +
                ", desc='" + desc + '\'' +
                '}';
    }

}
